import { asyncRoutes, constantRoutes } from '@/router'

const state = {
  routes: []
}
const mutations = {
  setRoutes(state, routes) {
    state.routes = [...constantRoutes, ...routes]
  }
}
const actions = {
  getRouter(store, menus) {
    console.log(7, menus)
    const routes = asyncRoutes.filter(router => menus.includes(router.name))
    store.commit('setRoutes', routes)
    return routes
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
